<!DOCTYPE html>
<html lang="en">
<head>
  <title>写文章</title>
  <%-include('head',{})%>
</head>
<body>
  <%-include('bar',{username:username})%> 
  <div class="article">
    <form method="post" action="/articles/write">
      <%# post请求不能使用query字符串的方式传值%>
      <%# 我们使用input隐藏传值%>
      <input type="hidden" name="id" value="<%=doc._id%>">
      <input type="hidden" name="username" value="<%=doc.username%>">


      <input type="text" name="title" placeholder="<%=doc.title%>" value="<%=doc.title%>">
      <textarea name="content" class="xheditor"><%=doc.content%></textarea>
      <%if(doc._id){%>
        <input type="submit" value="修改">
        <%}else{%>
        <input type="submit" value="发布">
        <%}%>
      
      
    </form>
  </div>
  <script type="text/javascript" src="/xheditor/jquery/jquery-1.4.4.min.js"></script>
  <script type="text/javascript" src="/xheditor/xheditor-1.2.2.min.js"></script>
  <script type="text/javascript" src="/xheditor/xheditor_lang/zh-cn.js"></script>
  <script>
    $('.xheditor').xheditor({
       tools:'full',
       skin:'default',
       upImgUrl:'/articles/upload',
       html5Upload:false,
       upMultiple:1
    })
  </script>
</body>
</html>
